package com.basics.api.enums.organization;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum GroupPermissionEnum {
    ALLOW_VIEW("ALLOW_VIEW", "允许查看他人详情");

    /** 状态码 **/
    private String code;
    /** 状态描述 **/
    private String description;

    /**
     * 根据code查找
     *
     * @param code code
     * @return 枚举
     */
    public static GroupPermissionEnum find(String code) {
        return Arrays.stream(GroupPermissionEnum.values())
                .filter(input -> input.getCode().equals(code))
                .findFirst()
                .orElse(null);
    }
}
